-- OOP测试
Account = {balance = 0}
function Account.withdraw(v)
    Account.balance = Account.balance - v
end

Account.withdraw(100)

Shape = {area = 0}

function Shape:new(o)
    o = o or {}
    setmetatable(o, self)
    self.__index = self
    -- self.area = 0
    return o
end

function Shape:printArea()
    print("图形的面积为：", self.area)
end

myShape = Shape:new(nil)
myShape:printArea()

Square = Shape:new()
function Square:new(o, x)
    o = o or Shape:new(o)
    setmetatable(o, self)
    self.__index = self
    self.area = x * x
    return o
end
function Square:printArea()
    print("正方形的面积为：", self.area)
end

mySquare = Square:new(nil, 4)
mySquare:printArea()
